#!/bin/bash
date_time=$2
version=$2
aicard_num=$1

start_device=`expr $aicard_num \* 4`
end_device=`expr $aicard_num \* 4 + 3`
ph_card=`expr $aicard_num`

lock_file=r.lock_${aicard_num}

rm -f $lock_file
touch $lock_file

for device_id in `seq ${start_device} ${end_device}`
    do
            # echo device_id:$device_id  | tee -a ${CUR_PATH}/$log_file
            # sh hbm_run.sh ${device_id} $CURTIME --card_id_$ph_card $ph_card && echo $device_id >> $lock_file &
            # echo "1" >> r.lock
            log_path=../../log/${date_time}/${version}/$device_id
            mkdir -p $log_path
            log_file=$log_path/test.log

            rm -f $log_file
            touch $log_file

            # echo $device_id
            sh sdaarun.sh ${device_id} $log_file && echo $device_id>>$lock_file &
done

#while [[ $(cat $lock_file | wc -l) < 4 ]]; do
            # echo "11111"
#            sleep 1
#done


wait
